<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
 <body bgcolor="#C0C0C0">
<?php
$connection = @mysql_connect('phpmyadmin.hosting.we.po.opole.pl', 'debesciak', 'informatyka1') 
or die('Brak połączenia z serwerem MySQL.<br />Błąd: '.mysql_error()); 
	

$db = @mysql_select_db('stelmach', $connection) 
or die('Brak polaczenia z bazą danych<br />Błąd: '.mysql_error()); 
$zapytanie = "SET charset utf8";
$wykonaj = mysql_query($zapytanie);
 
 ?>
<?php

//usuwanie
if(isset($_POST['form1'])) {
switch($_POST['form1']){
	case '10' : {
if(!empty($_POST['id_a']))
{
	$id=$_POST['id_a'];
if(isset($_POST['submit2'])) {
	$zapytanie3 = "DELETE FROM `artykuly` WHERE `ID_ARTYKULU` = '$id'";
	mysql_query($zapytanie3) or die(mysql_error());
	print("<h2>Article was removed</h2>");
}
}
else
	echo "Podaj ID";
};
break;
}
}
echo "<br />";
?>
<?php
$zapytanie4 = "SELECT ID_ARTYKULU, TYTUL, TRESC, AUTOR FROM artykuly";;
$wykonaj2 = mysql_query($zapytanie4);
$znaleziono2 = mysql_num_rows($wykonaj2);
if ($znaleziono2 == "0")  {
  print "There is no articles!";
}

?>
<table border="1" align="center">
<tr>
		<th style="height: 28px; text-transform:uppercase;">ID</th>
		<th style="height: 28px; text-transform:uppercase;">Title</th>	
		<th style="height: 28px; text-transform:uppercase;">Content</th>	
		<th style="height: 28px; text-transform:uppercase;">Author</th>					
</tr>

<?php
while ($row = mysql_fetch_array($wykonaj2))  {
 echo "<tr><td>".$row['ID_ARTYKULU']."</td><td>".$row['TYTUL']."</td><td>".$row['TRESC']."</td><td>".$row['AUTOR']."</td></tr>";
}
echo "</table>";

echo "<br /><br />";

?>

<br />
<form style="background-color:#C0C0C0" method=post>
<input type="hidden" name="form1" value="10">
<h1>Delete the article</h1>
<h2>Fill the form</h2>
<table border=0>
<tr><td style="height: 48px">ID ARTICLE</td><td style="height: 48px"><textarea name="id_a"></textarea></td></tr>

<tr><td colspan=2><input type=submit name="submit2" value='Delete'></td></tr></table>
</form>










</body>


</html>